#!/bin/bash

# postinst script for developer-dtrace
#
# see: dh_installdeb(1)

#set -e

# summary of how this script can be called:
#        * <postinst> \`configure' <most-recently-configured-version>
#        * <old-postinst> \`abort-upgrade' <new version>
#        * <conflictor's-postinst> \`abort-remove' \`in-favour' <package>
#          <new-version>
#        * <postinst> \`abort-remove'
#        * <deconfigured's-postinst> \`abort-deconfigure' \`in-favour'
#          <failed-install-package> <version> \`removing'
#          <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

PATH=/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH

if [ "${BASEDIR:=/}" = "/" ]; then
    BASEDIR=""
else
    BASEDIR_OPT="-b $BASEDIR"
fi

case "$1" in
    configure)
        chown root:bin $BASEDIR/usr/demo
	chown root:bin $BASEDIR/usr/demo/dtrace
	chown root:bin $BASEDIR/usr/lib/dtrace
	chown root:bin $BASEDIR/usr/lib/dtrace/64
	chown root:sys $BASEDIR/usr/lib/mdb/kvm/amd64
	chown root:sys $BASEDIR/usr/lib/mdb/raw
	chown root:sys $BASEDIR/usr/lib/mdb/raw/amd64
	chmod 0444 "$BASEDIR/usr/lib/dtrace/64/drti.o"
	chown root:bin "$BASEDIR/usr/lib/dtrace/64/drti.o"
#	chmod 0444 "$BASEDIR/usr/lib/dtrace/drti.o"
#	chown root:bin "$BASEDIR/usr/lib/dtrace/drti.o"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/errno.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/errno.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/fc.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/fc.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/io.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/io.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/ip.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/ip.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/iscsit.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/iscsit.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/mac.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/mac.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/net.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/net.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/nfs.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/nfs.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/nfssrv.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/nfssrv.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/procfs.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/procfs.d"
#	chmod 0444 "$BASEDIR/usr/lib/dtrace/regs.d"
#	chown root:bin "$BASEDIR/usr/lib/dtrace/regs.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/sched.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/sched.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/scsi.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/scsi.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/signal.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/signal.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/srp.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/srp.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/sysevent.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/sysevent.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/tcp.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/tcp.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/udp.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/udp.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/unistd.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/unistd.d"
	chmod 0444 "$BASEDIR/usr/lib/dtrace/vnd.d"
	chown root:bin "$BASEDIR/usr/lib/dtrace/vnd.d"
	chmod 0555 "$BASEDIR/usr/lib/dtrace/64/libdtrace_forceload.so"
	chown root:bin "$BASEDIR/usr/lib/dtrace/64/libdtrace_forceload.so"
#	chmod 0555 "$BASEDIR/usr/lib/dtrace/libdtrace_forceload.so"
#	chown root:bin "$BASEDIR/usr/lib/dtrace/libdtrace_forceload.so"
	chmod 0555 "$BASEDIR/usr/sbin/dtrace"
	chown root:bin "$BASEDIR/usr/sbin/dtrace"
	chmod 0555 "$BASEDIR/usr/sbin/intrstat"
	chown root:bin "$BASEDIR/usr/sbin/intrstat"
	chmod 0555 "$BASEDIR/usr/sbin/lockstat"
	chown root:bin "$BASEDIR/usr/sbin/lockstat"
	chmod 0555 "$BASEDIR/usr/sbin/plockstat"
	chown root:bin "$BASEDIR/usr/sbin/plockstat"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/applicat.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/applicat.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/badopen.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/badopen.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/begin.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/begin.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/callout.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/callout.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/clause.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/clause.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/clear.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/clear.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/countdown.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/countdown.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/counter.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/counter.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/dateprof.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/dateprof.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/delay.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/delay.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/denorm.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/denorm.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/end.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/end.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/error.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/error.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/errorpath.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/errorpath.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/find.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/find.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/firebird.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/firebird.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/hello.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/hello.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/howlong.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/howlong.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/index.html"
	chown root:bin "$BASEDIR/usr/demo/dtrace/index.html"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/interp.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/interp.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/interval.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/interval.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/intr.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/intr.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/iocpu.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/iocpu.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/iosnoop.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/iosnoop.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/iothrough.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/iothrough.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/iotime.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/iotime.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/ipio.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/ipio.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/ipproto.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/ipproto.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/iprb.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/iprb.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/kstat.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/kstat.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/ksyms.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/ksyms.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/libc.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/libc.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/lquantize.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/lquantize.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/lwptime.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/lwptime.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/normalize.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/normalize.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/nscd.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/nscd.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/pri.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/pri.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/printa.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/printa.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/pritime.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/pritime.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/prof.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/prof.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/profpri.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/profpri.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/progtime.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/progtime.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/putnext.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/putnext.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/qlen.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/qlen.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/qtime.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/qtime.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/renormalize.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/renormalize.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/restest.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/restest.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/ring.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/ring.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/rtime.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/rtime.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/rwinfo.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/rwinfo.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/rwtime.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/rwtime.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/sig.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/sig.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/soffice.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/soffice.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/spec.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/spec.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/specopen.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/specopen.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/ssd.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/ssd.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/syscall.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/syscall.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tcp1stbyte.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tcp1stbyte.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tcpbytes.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tcpbytes.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tcpbytesstat.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tcpbytesstat.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tcpconnlat.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tcpconnlat.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tcpio.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tcpio.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tcpioflags.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tcpioflags.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tcprst.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tcprst.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tcpsnoop.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tcpsnoop.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tcpstate.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tcpstate.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tcptop.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tcptop.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tick.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tick.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/ticktime.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/ticktime.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/time.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/time.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/tracewrite.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/tracewrite.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/trunc.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/trunc.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/trussrw.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/trussrw.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/udpbytes.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/udpbytes.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/udpbytesstat.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/udpbytesstat.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/udpio.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/udpio.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/udpsnoop.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/udpsnoop.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/udptop.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/udptop.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/userfunc.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/userfunc.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/whatfor.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/whatfor.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/whatlock.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/whatlock.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/where.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/where.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/whererun.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/whererun.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/whoexec.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/whoexec.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/whofor.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/whofor.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/whoio.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/whoio.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/whopreempt.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/whopreempt.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/whoqueue.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/whoqueue.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/whosteal.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/whosteal.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/whowrite.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/whowrite.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/writes.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/writes.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/writesbycmd.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/writesbycmd.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/writesbycmdfd.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/writesbycmdfd.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/writetime.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/writetime.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/writetimeq.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/writetimeq.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/xioctl.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/xioctl.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/xterm.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/xterm.d"
	chmod 0644 "$BASEDIR/usr/demo/dtrace/xwork.d"
	chown root:bin "$BASEDIR/usr/demo/dtrace/xwork.d"
	chmod 0755 "$BASEDIR/usr/lib/amd64/libdtrace.so.1"
	chown root:bin "$BASEDIR/usr/lib/amd64/libdtrace.so.1"
	chmod 0755 "$BASEDIR/usr/lib/libdtrace.so.1"
	chown root:bin "$BASEDIR/usr/lib/libdtrace.so.1"
	chmod 0555 "$BASEDIR/usr/lib/mdb/kvm/amd64/dtrace.so"
	chown root:sys "$BASEDIR/usr/lib/mdb/kvm/amd64/dtrace.so"
	chmod 0555 "$BASEDIR/usr/lib/mdb/raw/amd64/dof.so"
	chown root:sys "$BASEDIR/usr/lib/mdb/raw/amd64/dof.so"
	chmod 0755 "$BASEDIR/usr/lib/devfsadm/linkmod/SUNW_dtrace_link.so"
	chown root:sys "$BASEDIR/usr/lib/devfsadm/linkmod/SUNW_dtrace_link.so"
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument '$1'" >&2
        exit 1
    ;;
esac



# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0

